/* eslint-disable no-unused-vars */
// import Vue from 'vue'
import elementui from '@/plugins/elementui'
import App from './App.vue'
// import echarts from 'echarts'
import Axios from './utils/request'
import store from './store'
import '@/utils/verify.js'
import filters from './utils/filters.js'
import router from './router'
import _ from 'lodash'
import permission from './components/Permission'
import '@/assets/style.scss'
//将流程按钮组件注册为全局组件
import ComExaButtons from '@/components/common/exaButtons'
Vue.component('ComExaButtons', ComExaButtons)

//注册详细页面顶部组件
import BillTop from '@/components/common/billTop'
Vue.component('BillTop', BillTop)

//注册悬浮审核历史组件
import ToolHistory from '@/components/common/toolHistory'
Vue.component('ToolHistory', ToolHistory)

// 全局过滤器
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key]) //插入过滤器名和对应方法
})

//单条删除提示
Vue.prototype.oneDeleteErr = '确定要删除吗？数据删除后不可恢复，请谨慎操作！'
Vue.prototype.oneDeleteListErr = '确定要删除吗？删除后需要重新引入，请谨慎操作！'
//多条删除提示
Vue.prototype.moreDeleteErr = param=>{ // 可传入数组，数字，字符串
    let num  = 0
    if(param instanceof Array) {
        num = param.length
    }else if( typeof param === 'number' || ( typeof param === 'string' && param !== '' )) {
        num = param
    }
    return `已选择【${ num }】条数据，确定要删除吗？数据删除后不可恢复，请谨慎操作！`
}
Vue.prototype.moreDeleteListErr = param=>{ // 可传入数组，数字，字符串
    let num  = 0
    if(param instanceof Array) {
        num = param.length
    }else if( typeof param === 'number' || ( typeof param === 'string' && param !== '' )) {
        num = param
    }
    return `已选择【${ num }】条数据，确定要删除吗？删除后需要重新引入，请谨慎操作！`
}
//审核撤回提示
Vue.prototype.undoAudit = '确定要撤回上一步审核操作吗？'
//详情页顶部高度
Vue.prototype.topHeight = 70
//供wpf测试调用
window.test = params => {
    alert(params)
}
// 全局自定义指令
// 防抖
Vue.directive('debounce', {
    inserted (el, binding) {
        el.addEventListener('click', e => {
            el.disabled = true
            setTimeout(() => {
                el.disabled = false
            }, binding.value || 500)
        })
    }
})
Vue.prototype.$bus = new Vue()

Vue.config.productionTip = false

Vue.prototype.$ELEMENT = { size: 'small' }
Vue.prototype.$Ajax = Axios
Vue.prototype.permission = permission.isPermission
Vue.prototype._ = _
// Vue.prototype.$echarts = echarts
Vue.use(permission)
const vm = new Vue({
    router,
    store,
    elementui,
    render: h => h(App)
}).$mount('#app')

export default vm